package com.kclm.pojo;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * @Author : lvhx
 * @Date: 2025/11/4 9:16
 * @Description:Bean后处理器 在Beanc初始化前后执行
 */
public class LogBeanPostProcessor implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("4 Bean后处理器的before方法执行，即将开始初始化");
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("7 Bean后处理器的after方法执行，已经完成初始化");
        return bean;
    }
}
